<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>02-属性案例</title>
    <style>
        img {
            width : 300px;
        }
    </style>
</head>
<body>
    <img src="./images/s.gif" alt="">
    <div>上午好</div>
    <script> 
      //分析需求： 根据不同的时间，显示不同的图片和div的内存

      let hour = prompt('请问几点了?');
        let img = document.querySelector('img');
        let div = document.querySelector('div');
        if(hour < 12){
            img.src = "images/s.gif";
            div.innerHTML = '上午好';
        } else if (hour < 14){
            img.src = "images/x.gif";
            div.innerHTML = '中午好';
        } else {
            img.src = "images/w.gif";
            div.innerHTML = '晚上好';
        }
    </script>
</body>
</html>